package com.imooc;

import com.imooc.controller.WelcomeController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.*;

import java.util.Arrays;

/**
 * <h1>简单容器</h1>
 * {@link BeanFactory}
 * 		{@link ListableBeanFactory} : 以列表的形式提供bean 的相关信息

 *
 * 组件扫描: 自动发下应用容器中需要创建的bean
 * 自动装配: 自动满足Bean之间的依赖
 * 		{@link AutowireCapableBeanFactory}
 * 			{@link AbstractAutowireCapableBeanFactory}
 * 				可以通过 {@link AutowireCapableBeanFactory#autowireBean(Object)} 实现对非容器管理bean的属性注入及其他操作
 *		{@link ConfigurableBeanFactory}
 *		{@link DefaultListableBeanFactory} :第一个可以独立运行的IOC容器,
 *
 *
 *
 * {@link ApplicationContext}
 * 		{@link org.springframework.core.env.EnvironmentCapable} 获取环境变量/运行参数等信息, 包含web参数
 *  实现:
 *  	{@link FileSystemXmlApplicationContext}
 *  	{@link ClassPathXmlApplicationContext}
 *  	{@link XmlWebApplicationContext}  web容器
 *  	{@link AnnotationConfigServletWebServerApplicationContext} web
 *  	{@link AnnotationConfigReactiveWebServerApplicationContext} reactive
 *  	{@link AnnotationConfigApplicationContext}
 *
 * @author : dzj
 * @create: 2021-11-04 19:36
 */
@Slf4j
@Configuration
@ComponentScan("com.imooc")
public class Debug0603 {

	public static void main(String[] args) {
		ApplicationContext ctx = new AnnotationConfigApplicationContext(Debug0603.class);
		WelcomeController welcomeController = ctx.getBean(WelcomeController.class);
		welcomeController.handleRequest();

	}
}
